/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package BO;

import BO.Iter.MonHocBO;
import DAO.Iter.MonHocDAO;
import TableModel.Monhoc;
import java.util.List;
import javax.el.ELContext;
import javax.el.ExpressionFactory;
import javax.el.ValueExpression;
import javax.faces.application.Application;
import javax.faces.context.FacesContext;
import org.primefaces.event.RowEditEvent;


/**
 *
 * @author vt
 */
public class MonHocBOImpl implements MonHocBO  {
       private MonHocDAO mhDao;
    public String toPageNew(){
        System.out.println("New Page Them Mon Hoc");
        return "addMonHoc";
    }
    public void update(Monhoc b){
        mhDao.update(b);
    }
    @Override
     public void add(Monhoc b){
        try{
             mhDao.add(b);
        }catch(Exception e){
            System.out.println(e.toString());
        }
       
    }
  @Override
    public List<Monhoc> listAllMonHoc() {
        return mhDao.findAllMonHoc();
    }
    public void setmhDao(MonHocDAO gvDao) {
        this.mhDao = gvDao;
    }
    public void edit(RowEditEvent event){
        Monhoc a =(Monhoc)event.getObject();
        System.out.println(a.getMamh());
        mhDao.update(a);
    }
    
  
   public String movePageShow(){
        return "showPageMonHoc";
    }
    @Override
    public void delete(Monhoc a) {
       mhDao.delete(a);
    }
    
     public void setMhDao(MonHocDAO mhDao) {
        this.mhDao = mhDao;
    }
     public MonHocDAO getMhDao() {
        return mhDao;
    }

    @Override
    public Monhoc findById(String id) {
       return mhDao.findById(id);
    }

    @Override
    public void edit(Monhoc a) {
        mhDao.update(a);
    }

   
    
}
